package com.jet.chat.dbquery;

import java.sql.Connection;

import com.jet.chat.service.DBConnectionService;

public abstract class ChatQueryAbstract {
	public ChatQueryResult execute(DBConnectionService dbConnectionService, ChatQueryParams chatQueryParams) throws Exception {
		if (dbConnectionService.isConnected()) {
			Connection conn = dbConnectionService.getConn();
			return main(conn, chatQueryParams);
		}
		return null;
	}

	protected abstract ChatQueryResult main(Connection conn, ChatQueryParams chatQueryParams) throws Exception;
}
